#include "sr.h"

void
posSensorsFire(double XC, int hasEventFlags, char *SWPoscarMin, char *SWPoscarMax, 
        int *craneKnownFlags, int *cranePresentFlags) {

    if(GET_BIT(hasEventFlags, XCBIT)) {
        if(XC < -5.0) {
            *SWPoscarMin = 1;
        }
        else {
            *SWPoscarMin = 0;
        }

        if(XC > 5.0) {
            *SWPoscarMax = 1;
        }
        else {
            *SWPoscarMax = 0;
        }

        SET_BIT_TRUE(*craneKnownFlags, SWPOSCARMINBIT);;
        SET_BIT_TRUE(*cranePresentFlags, SWPOSCARMINBIT);
        SET_BIT_TRUE(*craneKnownFlags, SWPOSCARMAXBIT);
        SET_BIT_TRUE(*cranePresentFlags, SWPOSCARMAXBIT);
    }
    
    if(!GET_BIT(*craneKnownFlags, SWPOSCARMINBIT)) {
        SET_BIT_TRUE(*craneKnownFlags, SWPOSCARMINBIT);
        SET_BIT_TRUE(*craneKnownFlags, SWPOSCARMAXBIT);
    }

}
